`include "chunjun_define.sv" 
`include "chunjun_lib_define.sv" 
 
 
//--------------------------------------------------//
//------------------onehot2bin----------------------//
//--------------------------------------------------//
module wing_cbb_onehot2bin #(
    parameter WIDTH = 8
) (
    input  logic [WIDTH-1 : 0]           onehot_i,
    output logic [$clog2(WIDTH)-1 : 0]   bin_o
);

for (genvar j = 0; j < $clog2(WIDTH); j++) begin : G_BIN
  logic [WIDTH-1:0] tmp_id;

  for (genvar i = 0; i < WIDTH; i++) begin : G_ID
    assign tmp_id[i] = i[j];
  end

  assign bin_o[j] = |(tmp_id & onehot_i);
end
 
endmodule

`include "chunjun_undefine.sv" 
